import axios from "axios"

export function download() {
	axios({
		//请求地址
		url: 'http://localhost:8080/axios/user/export',
		//请求方式
		method: 'GET',
		responseType:'blob',
	}).then(function(response) {
		downloadFile(response.data,"课程数据");
	})
}


function downloadFile(data) {
	// 文件导出
	if (!data) {
		return
	}
	let url = window.URL.createObjectURL(new Blob([data]));
	let link = document.createElement('a');
	link.style.display = 'none';
	link.href = url;
	//文件名
	link.setAttribute('download', 'ss.xlsx');
	document.body.appendChild(link);
	link.click()
}
